﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using Mal.Balades.Admin.Services;

namespace Mal.Balades.Admin.AdminWebService
{
    public partial class Picture:IPicture
    {
        public static Picture Convert(IPicture source)
        {
            Picture result = new Picture();
            result.PictureID = source.PictureID;
            result.PictureTypeID = source.PictureTypeID;
            result.Rank = source.Rank;
            result.Text = source.Text;
            result.Title = source.Title;
            result.Url = source.Url;
            result.VisitID = source.VisitID;

            return result;
        }

        public static ReadOnlyCollection<IPicture> Convert(IEnumerable<Picture> sources)
        {
            List<IPicture> results = new List<IPicture>();

            foreach (Picture item in sources)
            {
                results.Add(item);
            }

            return new ReadOnlyCollection<IPicture>( results);
        }

        public static List<Picture> Convert(IEnumerable<IPicture> sources)
        {
            List<Picture> results = new List<Picture>();

            foreach (IPicture item in sources)
            {
                results.Add(Picture.Convert(item));
            }

            return results;
        }
    }
}
